package com.boot.unity.api.modules.cert.dao;

import com.boot.unity.api.modules.cert.entity.Cert;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CertDao {

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into user_cert(appId, appSecret, user, createTime, updateTime) values (#{appId}, #{appSecret}, #{user}, now(), now() )")
    int save(Cert cert);

    @Select("select * from user_cert where user = #{user} limit 1")
    Cert getByUser(@Param("user") String user);

    @Select("select * from user_cert order by createTime DESC")
    List<Cert> list();
}
